<?php use_helper('PA_Links') ?>
<?php if(isset($form)): ?>
<?php echo $form->renderFormTag(link_to_app('Store', 'createOrder'), array('id' => 'orderForm')) ?>
<input type="hidden" name="demand" value="<?php echo $sf_request->getParameter('demand') ?>" />
<table id="storeOrderTable" style="display: inline-table">
  <tr>
    <th>Projekt</th>
    <td colspan="3"><?php echo $demand->getProject(); ?></td>
  </tr>
  <tr>
    <th>Opis</th>
    <td colspan="3"><?php echo $demand->getDescription() ?></td>
  </tr>
  <tr>
    <th>Adres dostawy</th>
    <td colspan="3"><?php echo $form['address_id']->render() ?></td>
  </tr>
  <tr>
    <th>Lp</th>
    <th style="min-width: 250px;">Materiał</th>
    <th>Ilość [<?php echo $demand->getCategory()->getQuantityUnit() ?>]</th>
    <th><span><?php echo $form['deliverer_id']->render(array('class' => 'middle')) ?> <input type="checkbox" class="middle" checked="checked" onclick="App.Form.toggleDisable('select', 'store_order_items');App.Form.toggleDisable('select', '\'store_order[deliverer_id]\'')" /></span></th>
  </tr>
  <?php foreach($demandItems as $item): ?>
    <tr>
      <td><p id="counter"></p></td>
      <td><?php echo $item->getStoreItem()->getName() ?></td>
      <td><?php echo $item->getValue() ?></td>
      <td><?php echo $form['deliverer_id']->render(array('name' => 'store_order_items['.$item->getStoreItem()->getId().']', 'disabled' => 'disabled')) ?></td>
    </tr>
  <?php endforeach; ?>
  <tr>
    <td colspan="4">
      <!-- <input type="button" value="Zapisz" onclick="App.Form.submit('orderForm', true)" /> -->
      <input type="button" value="Zapisz i wyślij" onclick="App.Form.submit('orderForm', true)" />
    </td>
  </tr>
</table>
<?php else: ?>
Błąd formularza.
<?php endif; ?>


